package com.qf.hospital.controller;

import com.qf.hospital.service.DoctorService;
import com.qf.hospital.service.RegisterService;
import com.qf.hospital.service.ReportService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author Administrator
 * @version V1.0
 * @Project hospital
 * @Package com.qf.hospital.controller
 * @Description: ${TODO}
 * @Date 2021/10/19 18:38
 */

@RestController
public class MainController {

    private Logger log = LoggerFactory.getLogger(RoleController.class);

    @Autowired
    private DoctorService doctorService;

    @Autowired
    private ReportService reportService;

    @Autowired
    private RegisterService registerService;

    @PostMapping("/main/paiban/{week}")
    public List<Map<String,Object>> scheduler(@PathVariable String week){
        //1. 调用Service查询指定星期的排班信息
        List<Map<String,Object>> result = doctorService.findSchedulerByWeek(week);
        //2.返回
        return result;
    }

    @PostMapping("/main/Total")
    public Integer reportTotal(){

        //1.调用service查询总门诊人数
        Integer count = reportService.findReportCountTotal();
        //2.返回
        return count;
    }

    @PostMapping("/main/currentNum")
    public Integer reportCurrent(){
        //1.调用service查询今日门诊人数
        Integer count = reportService.findReportCountCurrent();
        //2.返回
        return count;
    }


    @PostMapping("/main/zhuyuanTotal")
    public Integer zhuyuanTotal(){
        Integer count = registerService.findZhuYuanTotal();
        return count;
    }

    @PostMapping("/main/currentZhuYuan")
    public Integer currentZhuYuan(){
        Integer count = registerService.findCurrentZhuYuan();
        return count;
    }
}
